package practice08;

public class Klass {
    //写一个Klass类，有number属性还有一个leader属性。
    //Klass有一个assignLeader方法，接收一个Student实例。意为将一名学生设置为该Klass的班长。
    //如果Klass的Leader是Tom，那么Tom调用introduce的方法就要返回：
    //>My name is Tom. I am 21 years old. I am a Student. I am Leader of Class 2.
    //如果没有就继续返回旧的字符串。
//    private Integer number;
//    Student leader;
//
//    public Klass(Integer number,Student leader) {
//        this.number = number;
//        this.leader=leader;
//    }
//
//    public Klass(int number) {
//        this.number=number;
//    }
//
//    public void setNumber(Integer number) {
//        this.number = number;
//    }
//    public Integer getNumber() {
//        return number;
//    }
//    private void setLeader(Student student) {
//        this.leader=leader;
//    }
//
//    public Student getLeader() {
//        return leader;
//    }
//
//    public String getDisplayName() {
//        return "Class " + number;
//    }
//
//    public void assignLeader(Student student) {
//        this.setLeader(student);
//    }

    private Integer number;

    private Student leader;

    public Klass(Integer number) {
        this.number = number;
    }

    public void setLeader(Student leader) {
        this.leader = leader;
    }

    public Student getLeader() {
        return leader;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getDisplayName() {
        return "Class " + number;
    }

    public void assignLeader(Student student) {
        this.setLeader(student);
    }
}
